package view;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JPanel;
import model.*;
import controller.*;

/*****************************************
 * gamePanel
 * 
 * Responsible for displaying any graphics on 
 * the screen
 * 
 * @author Stephen Gregory, Jun Wang
 *
 */

public class titlePanel extends JPanel {

	private static final long serialVersionUID = 2142659384555307593L;
		BufferedImage bkgd;
		Font gameFont;
		JButton playButton = new JButton("Play");
		JButton instrButton = new JButton("Instructions");
		JButton leaderBoardButton = new JButton("Leaderboard");

		public titlePanel() {
			setLayout(null);
			setPreferredSize(new Dimension(1000, 600));	
			bkgd = null;	
			gameFont = new Font(Font.SANS_SERIF, Font.BOLD, 14);
			try {
				bkgd = ImageIO.read(new File("title.jpg"));
			} catch (IOException e) {}
	        
            //add them to the board
	        playButton.setBounds(440, 380, 160, 30);	        
	        instrButton.setBounds(440, 420, 160, 30);
	        leaderBoardButton.setBounds(440, 460, 160, 30);
	        add(playButton);
	        add(instrButton);
	        add(leaderBoardButton);  
		}
		
	
	    public void paintComponent(Graphics g) {
	    	super.paintComponent(g);
			g.drawImage(bkgd, 0, 0, null);
	    }
	    
		@Override
		public boolean isFocusTraversable() {
		  return true;
		}
	    
	    public void addPlayListener(ActionListener a) {
	       playButton.addActionListener(a);
	    }
	    
	    public void addLeaderBoardListener(ActionListener a) {
	        leaderBoardButton.addActionListener(a);
	    }


		public void addInstrListener(ActionListener a) {
			instrButton.addActionListener(a);
		}
}